//
//  global.cpp
//  NLCEQ_mixed
//
//  Created by Duong Ngo on 8/5/16.
//  Copyright © 2016 Duong Ngo. All rights reserved.
//

#include "global.hpp"
#include <math.h>

/* GLOBAL PARAMETERS */


//Bankers
const double varphi=0.002;      // Reserves Requirement
const double beta_b = 0.99;      // Bankers's discount factor
const double Rn=  1+0.25/400;  // Lower bound of interest on reserves
const double kappa=0.22;         // Capital requirement
const double thetaa=0.0005;     // Cost of collecting loan
const double deltab= 0.5;       // Loan amortization
const double kappa_shock= 0.26;   // The initial value of kappa shock


//Households
const double beta_h = 0.985;      // Household's discount factor
const double epsilon= 4;        // Elasticity of substitution
const double alphaa=0.34;       // Parameters in production function
const double psi=0.2;          // Collateral constraints
const double deltak = 0.025;    // Capital depriciation
const double iota=100;           //Nominal Price Rigidity
const double chi= 0.586;        // Labor disutility
const double bh_limit= 3.4;     // Borrowing limit
const double nu = 0.5;          // Inverse Frisch elasticity


//Government policy
const double phipie= 1.25;    //Policy repsonds to inflation
const double phiy= 0; //Policy respond to output gap
const double rho_x= 0.98; // Persistence of policy rule of LSAP

//Shock
const double rho = 0.95; // Persistence of shock



//FOC Problem
const int var_foc= 29; //Number of variables in each period
const int dim_state= 7; // Number of state variables
const int dim_forward= 8; // Number of foward variables
const int T= 300; // Number of periods

//Other variables
const double s_max= 1e6;    // Coefficient in soft-max constraint
const double Rf_min= 1+0.5/400; // The minimum of FFR > Rn
double max_error=0; //Check the maximum error
const double pe= 1e4;
const double x_shock = 0.0008;   // The initial shock of purchasing x
const double kappa_homotopy = 0.24; // The value of kappa in homotopy
const int T_rn_back = 200; // Time when Rn back to its steady state value



// Global vector
std::vector<double> result(var_foc);  // Store result in Ipopt
std::vector<int> state_position(dim_state); // Position of state var
std::vector<int> forward_position(dim_forward); // Position of forward var
std::map<std::string, int> original_map; // Map the name of variable to its position
std::vector<int> var_role(var_foc); //Vector stores the role of each variable (0: state, 1: other)
std::vector<double> starting_state(dim_state); // The state at time 0
std::map<std::string, int> eqn_map; //Map the name of equation to its position
std::vector<double> vec_kappa(T+1); //Exogenous variables
std::vector<double> vec_x(T+1); // Exogenous rule for purchasing x
std::vector<double> vec_rn(T+1); // Exogenous rule for Interest on Reserves 














